package com.JUC.cha05.setc01;

/**
 * 如果线程处于正常活动状态，将线程的中断标识设置为true，仅此而已，并不会中断
 */
public class InterruptDemo2 {

    public static void main(String[] args) throws InterruptedException {

        Thread t1 = new Thread(() -> {
            for (int i = 1; i <= 300; i++) {
                System.out.println(Thread.currentThread().getName() + "\t" + i);
            }
            System.out.println("更改后的标识符的标识02：" + Thread.currentThread().isInterrupted());
        }, "t1");
        t1.start();

        System.out.println("当前标识符：" + t1.isInterrupted());

        Thread.sleep(1);

        new Thread(() -> {
            t1.interrupt();
            System.out.println("更改后的标识符的标识01：" + t1.isInterrupted());
        }, "t2").start();
        Thread.sleep(10);
        System.out.println("更改后的标识符的标识03：" + t1.isInterrupted());
    }
}
